﻿<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>登录</title>
<script src="js/angular.js"></script>
<link rel="stylesheet" type="text/css" href="css/index.css"/>
</head>
<body ng-app="myApp">
	<div>
		<ul id="loginForm" ng-controller="LoginForm">
			<li>用户名：<input type="text" name="uname" ng-model="uname" /></li>
			<li>密　码：<input type="password" name="pword" ng-model="pword" /></li>
			<li id="loginBtn"><input type="button" value="提交" ng-click="submit()"/> <input type="button" value="重置" ng-click="resetInfo()"/></li>
		</ul>
	</div>
	
<script>
angular.module("myApp", [])
	.controller("LoginForm", function($scope,$http) {
	$scope.resetInfo=function()
	{
		$scope.uname="";
		$scope.pword="";
	}
	$scope.submit=function()
	{
		var postData = "?uname="+$scope.uname+"&"+"pword="+$scope.pword;
		var url = "insertJsonpServlet" + postData;
		$http.post(url,postData).success(function(data)
		{	
			console.log(typeof(data));
			var json = eval("(" + data + ")");;
			alert(json.text+json.text1);
		}).error (function(data)
		{
			alert("错了");
		})
		
	}

});
</script>
</body>
</html>
